/**
 * @param {string[]} list1
 * @param {string[]} list2
 * @return {string[]}
 */
 var findRestaurant = function(list1, list2) {
  let vocab = new Map();
  list1.map((e, i) => {
      vocab.set(e, i);
  });
  let ret = [];
  let min = Infinity;
  list2.map((e, i) => {
      let c = vocab.get(e);
      if(c !== undefined) {
          if(c + i < min) {
              ret = [e];
              min = c + i;
          } else if (c + i === min) {
              ret.push(e);
          }
      }
  }); 
  return ret; 
};